﻿using System;

namespace BLL.Extensions
{
    /// <summary>
    /// Contains extension methods for byte arrays.
    /// </summary>
    public static class ByteArrayExtensions
    {
        /// <summary>
        /// Converts bytes array to base64 string.
        /// </summary>
        /// <param name="value">The array to convert.</param>
        /// <returns><paramref name="value"/> encoded as base64 string.</returns>
        public static string ToBase64String(this byte[] value)
        {
            return Convert.ToBase64String(value);
        }

        /// <summary>
        /// Converts bytes array to hexadecimal string.
        /// </summary>
        /// <param name="value">The array to convert.</param>
        /// <returns><paramref name="value"/> encoded as hexadecimal string.</returns>
        public static string ToHexString(this byte[] value)
        {
            return BitConverter.ToString(value).Replace("-", string.Empty);
        }
    }
}